﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using Javavaj.iHunter;
using Javavaj.iHunter.Database;

namespace Javavaj.iHunter.Core
{
    public partial class ConfigManager : Component
    {
        GlobalSettings globalSettings;

        public GlobalSettings GlobalSettings
        {
            get { return globalSettings; }
        }
        PluginSettings pluginSettings;

        public PluginSettings PluginSettings
        {
            get { return pluginSettings; }
        }
        ChannelSettings channelSettings;

        public ChannelSettings ChannelSettings
        {
            get { return channelSettings; }
        }

        UserDbDataSet dataSet;

        [DefaultValue(null)]
        public UserDbDataSet DataSet
        {
            get { return dataSet; }
            set
            {
                dataSet = value;
                LoadSettings();
            }
        }

        public ConfigManager()
        {
            InitializeComponent();
            LoadSettings();
        }

        private void LoadSettings()
        {
            globalSettings = new GlobalSettings(dataSet);
            pluginSettings = new PluginSettings(dataSet);
            channelSettings = new ChannelSettings(dataSet);
        }

        public ConfigManager(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
            LoadSettings();
        }
    }
}
